package cn.iocoder.yudao.module.dt.dal.mysql.activitysumbit;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dt.dal.dataobject.activitysumbit.ActivitySumbitDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dt.controller.admin.activitysumbit.vo.*;

/**
 * 活动提交 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ActivitySumbitMapper extends BaseMapperX<ActivitySumbitDO> {

    default PageResult<ActivitySumbitDO> selectPage(ActivitySumbitPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivitySumbitDO>()
                .likeIfPresent(ActivitySumbitDO::getSubmitName, reqVO.getSubmitName())
                .eqIfPresent(ActivitySumbitDO::getSubmitContent, reqVO.getSubmitContent())
                .eqIfPresent(ActivitySumbitDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ActivitySumbitDO::getOpenId, reqVO.getOpenId())
                .eqIfPresent(ActivitySumbitDO::getFee, reqVO.getFee())
                .eqIfPresent(ActivitySumbitDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(ActivitySumbitDO::getFeeItemId, reqVO.getFeeItemId())
                .betweenIfPresent(ActivitySumbitDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivitySumbitDO::getId));
    }

    default List<ActivitySumbitDO> selectList(ActivitySumbitExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ActivitySumbitDO>()
                .likeIfPresent(ActivitySumbitDO::getSubmitName, reqVO.getSubmitName())
                .eqIfPresent(ActivitySumbitDO::getSubmitContent, reqVO.getSubmitContent())
                .eqIfPresent(ActivitySumbitDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ActivitySumbitDO::getOpenId, reqVO.getOpenId())
                .eqIfPresent(ActivitySumbitDO::getFee, reqVO.getFee())
                .eqIfPresent(ActivitySumbitDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(ActivitySumbitDO::getFeeItemId, reqVO.getFeeItemId())
                .betweenIfPresent(ActivitySumbitDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivitySumbitDO::getId));
    }

}
